<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript" charset="utf-8" src="${ctx}/jslib/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctx}/jslib/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="${ctx}/jslib/ueditor/lang/zh-cn/zh-cn.js"></script>
    <style>
    .slider-h{
    margin-left:80px;
    }
    </style>
<div style="padding: 3px;">
	<form id="newsAddForm" method="post">
		<table class="grid">
			<tr>
				<td>栏目</td>
				<td>
					<select id="cc" name="categoryId" style="width:100px;">
<option value="1">公告</option>
</select>
				</td>
				
			</tr>
			<tr>
				<td>标题</td>
				<td><input style="width:200px;" name="title" type="text" placeholder="请输入标题" class="easyui-validatebox span2" data-options="required:true" ></td>
				
			</tr>
			<tr>
				<td>副标题</td>
				<td><input style="width:200px;" name="subtitle" type="text" placeholder="请输入副标题" class="easyui-validatebox span2"></td>
			</tr>
			<tr>
				<td>关键词</td>
				<td><input style="width:200px;" name="tags" type="text" placeholder="" class="easyui-validatebox span2" data-options="width:140,height:29" ></td>
			</tr>
			<tr>
				<td>来源</td>
				<td><input id="source" name="source" style="width: 200px;"></input>
				<a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#pid').combotree('clear');" >清空</a></td>
			</tr>
			<tr>
				<td>描述</td>
				<td><textarea name="description" rows="2" cols="50" ></textarea></td>
			</tr>
			<tr>
				<td>内容</td>
				<td>
				<input type="hidden" id="myContent" name="content" />
				<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script></td>
			</tr>
			<tr>
				<td>权重</td>
				<td>
				<div style = "white-space:nowrap;">
				<input style="width:60px;float:left;" value="60" id="ff" name="weight" type="text" placeholder="" class="easyui-validatebox span2"/>
				<input id="ss" class="easyui-slider" value="60" style="width:300px;" data-options="  
                showTip:false,  
                rule: [0,'|',25,'|',50,'|',75,'|',100],  
                tipFormatter: function(value){  
                    return value;  
                },  
                onChange: function(value){  
                    $('#ff').val(value);  
                }"/></div>
				</td>
			</tr>
			<tr>
				<td>状态</td>
				<td>
					<input type="radio" name="status" value="0" checked="checked" />发布 
					<input type="radio" name="status" value="1" />草稿
				</td>
			</tr>
			<tr><td></td>
				<td><input value="提交" onclick="addnews()" type="button"/></td>
			</tr>
		</table>
	</form>
</div>
<script>
$(function(){
	$('#cc').combobox({
		url:'${ctx}/cate/getname',
		valueField:'id',
		textField:'name'
		}); 
});
var editor;  
$(document).ready(function() {
   editor = new baidu.editor.ui.Editor();  
   editor.render("editor");          
});  
function addnews(){
	$("#myContent").val(editor.getContent());
	$.ajax({
    cache: true,
    type: "POST",
    url:'${ctx}/news/add',
    data:$('#newsAddForm').serialize(),// 你的formid
    async: false,
    error: function(request) {
        alert("Connection error");
    },
    success: function(data) {
        alert(data);
    }
});

}
</script>